package com.xm9m.ibczy.mytest.alimama.mobile.demo;

import android.content.Intent;
import android.os.Bundle;
import android.view.ViewGroup;

import com.alimama.mobile.sdk.MmuSDK;
import com.alimama.mobile.sdk.config.ContainerProperties;
import com.alimama.mobile.sdk.config.MmuSDKFactory;
import com.xm9m.ibczy.mytest.R;

public class ContainerActivity extends BaseActivity {

	private MmuSDK mmuSDK;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.taobao_example_xp_container_activity);
		setTitle("内嵌");

		ViewGroup l = (ViewGroup) findViewById(R.id.ad);
		// String slotId = "64806";
		String slotId = "65177";
		setupAlimama(l, slotId);

	}

	private void setupAlimama(ViewGroup l, String slotId) {
		mmuSDK = MmuSDKFactory.getMmuSDK();
		mmuSDK.init(getApplication());
		mmuSDK.accountServiceInit(this);

		ContainerProperties properties = new ContainerProperties(this, slotId,
				l);
		mmuSDK.attach(properties);
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (!mmuSDK.accountServiceHandleResult(requestCode, resultCode, data,
				this)) {
			super.onActivityResult(requestCode, resultCode, data);
		}
	}
}
